import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:share_fit/app/controllers/space/person/person_logic.dart';
import 'package:share_fit/app/helper/ext/tr_ext.dart';
import 'package:share_fit/app/tools/color_const.dart';
import 'package:share_fit/app/tools/locale_tool.dart';
import 'package:share_fit/generated/locales.g.dart';

class DelConfirmDialog extends Dialog {
  Function callback;
  String inputVal = "";
  final logic = Get.put(PersonLogic());

  DelConfirmDialog({required this.callback});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
        child: Material(
            type: MaterialType.transparency,
            child: Center(
                child: GestureDetector(
                    onTap: () {
                      print('～');
                    },
                    child: Container(
                      width: 916.w,
                      height: 650.w,
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.circular(10),
                        color: Colors.white,
                      ),
                      child: Column(
                        children: [
                          Container(
                            margin: EdgeInsets.fromLTRB(42.w, 80.h, 42.w, 0),
                            child: Text(LocaleKeys.space_account_del.ts, style: TextStyle(color: ColorConst.btnFontColor, fontSize: 54.sp),),
                          ),
                          Container(
                              height: 150.h,
                              width: double.infinity,
                              margin: EdgeInsets.fromLTRB(70.w, 20.h, 70.w, 75.h),
                              alignment: Alignment.center,
                              child: TextField(
                                obscureText: true,
                                textAlign: TextAlign.left,
                                maxLines: 1,
                                cursorColor: Colors.grey,
                                decoration: InputDecoration(
                                  hintText: LocaleKeys.login_input_password.ts,
                                  filled: true,
                                  fillColor: ColorConst.mainBgColor,
                                  border: OutlineInputBorder(
                                    borderRadius: BorderRadius.circular(10.0), // 设置边框圆角
                                    borderSide: BorderSide.none, // 设置边框线条为无
                                  ),
                                ),
                                onChanged: (value) {
                                  logic.save('temp_text', value);
                                },
                              )
                          ),
                          GestureDetector(
                              behavior: HitTestBehavior.opaque,
                              child: Container(
                                  width: 832.w,
                                  height: 136.h,
                                  alignment: Alignment.center,
                                  decoration: BoxDecoration(
                                    color: ColorConst.activeColor,
                                    borderRadius: BorderRadius.circular(10),
                                  ),
                                  child: Text(
                                      LocaleKeys.ok.ts,
                                      textAlign: TextAlign.center,
                                      style: TextStyle(color: Colors.white, fontSize: 54.sp, fontWeight: FontWeight.w400)
                                  )
                              ),
                              onTap: () {
                                Navigator.pop(context);
                                callback(inputVal);
                              }),
                        ],),)
                ))),
        onTap: () {
          Navigator.pop(context);
        }
    );
  }
}